#!/usr/bin/env python
# -*- coding: utf-8 -*-

from flask import g
from flask_restful import Resource
from common.odooClient import Client

class ProductProductListAPI(Resource):
    def get(self):
        odoo = Client.getInstance()
        product_model = odoo.model('product.product')
        product_ids = product_model.search([])
        product_list = product_model.read(product_ids, ['id', 'name', 'list_price'])
        return {'good_products': product_list, 'hot_products': product_list, 'recently_products': product_list}

class ProductProductAPI(Resource):
    def get(self, id):
        odoo = Client.getInstance()
        product_model = odoo.model('product.product')
        product_id = product_model.read(id, ['id', 'name', 'list_price'])
        return product_id